/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author iwaki
 */

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;


public class Compare {
	public static void main(String[] args)
	{
	Compare compare = new Compare();

	double x = compare.readx();
	double y = compare.ready();
	double z = compare.readz();

   

	String outputSt = compare.judge(x, y, z);

	compare.write(outputSt);
	}



	public double readx() {
        BufferedReader br = null;
        try {
            File inputfile = new File("C:/textdata/input.txt");
            if (checkBeforeReadfile(inputfile)){


            br = new BufferedReader(new FileReader(inputfile));
            String line;
            while ((line = br.readLine()) != null) {
            	String[] data = line.split("\t");
            	double x = Double.valueOf(data[0]);

                return x;
                }
            }else{
            	System.out.println("Can't find or open");
            }

        } catch (IOException e) {
            e.printStackTrace();

        } finally {
            try {
                br.close();
            } catch (IOException e) {
            }
        }
		return 0;

    }
	public double ready() {
        BufferedReader br = null;
        try {
            File inputfile = new File("C:/textdata/input.txt");
            if (checkBeforeReadfile(inputfile)){


            br = new BufferedReader(new FileReader(inputfile));
            String line;
            while ((line = br.readLine()) != null) {
            	String[] data = line.split("\t");
                double y = Double.valueOf(data[1]);

                return y;
                }
            }else{
            	System.out.println("Can't find or open");
            }

        } catch (IOException e) {
            e.printStackTrace();

        } finally {
            try {
                br.close();
            } catch (IOException e) {
            }
        }
		return 0;

    }
	public double readz() {
        BufferedReader br = null;
        try {
            File inputfile = new File("C:/textdata/input.txt");
            if (checkBeforeReadfile(inputfile)){


            br = new BufferedReader(new FileReader(inputfile));
            String line;
            while ((line = br.readLine()) != null) {
            	String[] data = line.split("\t");
                double z = Double.valueOf(data[2]);

                return z;
                }
            }else{
            	System.out.println("Can't find or open");
            }

        } catch (IOException e) {
            e.printStackTrace();

        } finally {
            try {
                br.close();
            } catch (IOException e) {
            }
        }
		return 0;

    }
	 private static boolean checkBeforeReadfile(File file){
		    if (file.exists()){
		      if (file.isFile() && file.canRead()){
		        return true;
		      }
		    }

		    return false;
		  }

	 public String judge(double x, double y, double z){
		 double setx = 1.0;
		 double sety = 1.0;
		 double setz = 1.0;
		 double norm = Math.sqrt(Math.pow(x - setx, 2) + Math.pow(y - sety, 2) + Math.pow(z - setz, 2));
		 double lim = 3.0;

		 if (norm < lim){
			 String outputSt = ("Good Posture");
			 return outputSt;
		 }else{
			 String dx = Double.toString(x - setx);
			 String dy = Double.toString(y - sety);
			 String dz = Double.toString(z - setz);
			 String normSt = Double.toString(norm);
			 String crlf = System.getProperty("line.separator");
			 String outputSt = ("Bad Posture" + crlf + "dx = "  + dx + crlf + "dy = " + dy + crlf + "dz = " + dz + crlf + "norm = " + normSt);

			 return outputSt;
		 }
	 }

	 public void write(String outputSt){
		    try{
		      File outputfile = new File("C:/textdata/output.txt");

		      if (checkBeforeWritefile(outputfile)){
		        FileWriter filewriter = new FileWriter(outputfile);
		        filewriter.write(outputSt);

		        filewriter.close();
		      }else{
		        System.out.println("Can't write");
		      }
		    }catch(IOException e){
		      System.out.println(e);
		    }
		  }

		  private static boolean checkBeforeWritefile(File file){
		    if (file.exists()){
		      if (file.isFile() && file.canWrite()){
		        return true;
		      }
		    }

		    return false;
		  }


}

